package com.zhuss.juc;

import java.util.concurrent.atomic.AtomicInteger;


public class Test02 {
	
	static int k = 0;
	
	static AtomicInteger ai = new AtomicInteger(0);
	
	public static void main(String[] args) throws InterruptedException {
		for (int j = 0; j < 100; j ++) {
			new Thread(()-> {
				for (int i = 0; i < 100; i++) {
					try {
						Thread.sleep(10);
					} catch (Exception e) {
						e.printStackTrace();
					}
					k++;
					ai.incrementAndGet();
					
				}
			}).start();
		}
		
		
		for (;;) {
			Thread.sleep(1000);
			System.out.println(k);
			System.out.println(ai.get());
		}
	}

}

